package com.ssm.controller;

import com.ssm.pojo.Business;
import com.ssm.pojo.vo.Result;
import com.ssm.service.IBusinessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/business")
public class BusinessController {
    @Autowired
    private IBusinessService businessService;

    @GetMapping
    public Result<Business> login(@RequestParam(name="username", required=true) String username,
                                  @RequestParam(name="password", required=true) String password){
        return this.businessService.login(username, password);
    }
    @GetMapping("/list")
    public Result<List<Business>> getBusiness(
            @RequestParam(name="businessName", required=false,defaultValue = "") String businessName){
        return this.businessService.getBusiness(businessName);
    }
}
